<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>A canvas shadow text example</title>

    <script type="text/xaml" id="xaml"><?xml version="1.0"?>
      <Canvas xmlns="http://schemas.microsoft.com/client/2007"></Canvas></script>
<script type="text/javascript" src="../uupaa-excanvas.js"></script>

    <script>
    function boot() {
      draw(document.getElementById('canvas').getContext('2d'));
      draw(document.getElementById('canvas2').getContext('2d'), 1);
      draw(document.getElementById('vmlcanvas').getContext('2d'));
    }
    function draw(ctx, disableShadowBlurAPI) {
      if (disableShadowBlurAPI) {
        ctx.xShadowBlur = 0; // Old Silverlight(ver1, ver2) rendering simulate
      }
      ctx.globalAlpha   = 1.0;
      ctx.font          = "24pt Arial";
      ctx.textBaseline  = "top";
      ctx.fillStyle     = "red";
      ctx.strokeStyle   = "blue";

      var text = setShadow(ctx, "gray", 0, 0, 0);
      ctx.fillText("fillText: "     + text, 10, 20);
      ctx.strokeText("strokeText: " + text, 10, 200);
      text = setShadow(ctx, "gray", 4, 4, 4);
      ctx.fillText("fillText: "     + text, 10, 60);
      ctx.strokeText("strokeText: " + text, 10, 240);
      text = setShadow(ctx, "pink", 4, -4, -4);
      ctx.fillText("fillText: "     + text, 10, 100);
      ctx.strokeText("strokeText: " + text, 10, 280);
      text = setShadow(ctx, "green", 4, 1, 1);
      ctx.fillText("fillText: "     + text, 10, 140);
      ctx.strokeText("strokeText: " + text, 10, 320);
    }
    function setShadow(ctx, color, blur, ox, oy) {
      ctx.setShadow(color, ox, oy, blur);
      return [color, ox, oy, blur].join(", ");
    }
    </script>
    <style type="text/css">
      body { margin: 20px; font-family: arial,verdana,helvetica; background: #fff;}
      h1 { font-size: 140%; font-weight:normal; color: #036; border-bottom: 1px solid #ccc; }
      canvas { border: 2px solid #000; float: left; margin-right: 20px; margin-bottom: 20px; }
      pre { float:left; display:block; background: rgb(238,238,238); border: 1px dashed #666; padding: 15px 20px; margin: 0 0 10px 0; }
    </style>
  </head>
  <body onload="uuCanvas.ready(boot);">
    <h1>A canvas <code style="text-shadow: 10px 10px 10px black">shadow text</code> example</h1>
    <div>
      <canvas id="canvas" width="360" height="360"></canvas>
      <canvas id="canvas2" width="360" height="360"></canvas>
      <canvas id="vmlcanvas" class="vml" width="360" height="360"></canvas>
      <pre>
&lt;canvas id="canvas" width="360" height="360"&gt;&lt;/canvas&gt;
&lt;canvas id="canvas2" width="360" height="360"&gt;&lt;/canvas&gt;
&lt;canvas id="vmlcanvas" class="vml" width="360" height="360"&gt;&lt;/canvas&gt;

function boot() {
  draw(document.getElementById('canvas').getContext('2d'));
  draw(document.getElementById('canvas2').getContext('2d'), 1);
  draw(document.getElementById('vmlcanvas').getContext('2d'));
}
function draw(ctx, disableShadowBlurAPI) {
  if (disableShadowBlurAPI) {
    ctx.xShadowBlur = 0; // Old Silverlight(ver1, ver2) rendering simulate
  }
  ctx.globalAlpha   = 1.0;
  ctx.font          = "24pt Arial";
  ctx.textBaseline  = "top";
  ctx.fillStyle     = "red";
  ctx.strokeStyle   = "blue";

  var text = setShadow(ctx, "gray", 0, 0, 0);
  ctx.fillText("fillText: "     + text, 10, 20);
  ctx.strokeText("strokeText: " + text, 10, 200);
  text = setShadow(ctx, "gray", 4, 4, 4);
  ctx.fillText("fillText: "     + text, 10, 60);
  ctx.strokeText("strokeText: " + text, 10, 240);
  text = setShadow(ctx, "pink", 4, -4, -4);
  ctx.fillText("fillText: "     + text, 10, 100);
  ctx.strokeText("strokeText: " + text, 10, 280);
  text = setShadow(ctx, "green", 4, 1, 1);
  ctx.fillText("fillText: "     + text, 10, 140);
  ctx.strokeText("strokeText: " + text, 10, 320);
}
function setShadow(ctx, color, blur, ox, oy) {
  ctx.setShadow(color, ox, oy, blur);
  return [color, ox, oy, blur].join(", ");
}
      </pre>
    </div>
  </body>
</html>
